<template>
	<view class="open-coures">
		<view class="book-search" @click="handBookSearch">
			<image class="search-icon" :src="imgUrl+'bookSearch.png'" mode=""></image>
			<text class="search-title">证书查询</text>
		</view>
		<view class="btn" @click="handOpen()">
			{{isOpenCourse?'课程已开通':'开通课程'}}
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			isOpenCourse: {
				default: false
			},
			courseId: {
				type: [String, Number],
				default: ''
			},
			isBook: {
				default: false
			}
		},
		data() {
			return {
				imgUrl: this.configImgUrl,
			};
		},
		methods: {
			handBookSearch() {
				if (this.isBook) {
					uni.navigateTo({
						url: '/pages/onlineTrain/trainDetails/bookSearch/bookSearch?courseId=' + this.courseId
					})
				}else{
					uni.showToast({
						icon:'none',
						title:'您目前没有证书'
					})
				}
				this.$emit('handBookSearch')

			},
			handOpen() {
				if (this.isOpenCourse) {
					uni.showToast({
						title: '课程已开通',
						icon: 'none'
					})
				} else {
					uni.navigateTo({
						url: '/pages/onlineTrain/trainDetails/courseForm/courseForm?courseId=' + this.courseId
					})
				}

			}
		}
	}
</script>

<style lang="scss" scoped>
	.open-coures {
		@include my-flex($fw: nowrap, $jc:$bs-sb);
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 110rpx;
		background: #FFFFFF;
		box-shadow: 0 0 18px 0 rgba(12, 23, 57, 0.16);

		.book-search {
			@include my-flex($fd: column, $ai:center, $jc:center);
			width: 150rpx;
			text-align: center;

			.search-icon {
				width: 44rpx;
				height: 44rpx;
			}

			.search-title {
				color: #808080;
				font-size: 20rpx;
			}
		}

		.btn {
			width: 600rpx;
			background-color: $bs-color-theme;
			color: #FFFFFF;
			font-size: 30rpx;
			line-height: 110rpx;
			text-align: center;
		}
	}
</style>
